package com.gzxw.mogublog.admin.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gzxw.mogublog.commons.entity.Role;
import com.gzxw.mogublog.commons.entity.SysLog;
import com.gzxw.mogublog.utils.R;
import com.gzxw.mogublog.xo.service.SysLogService;
import com.gzxw.mogublog.xo.vo.SysLogVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/log")
public class LogController {

    @Autowired
    private SysLogService sysLogService;


    @PostMapping("/getLogList")
    public R getLogList(@RequestBody SysLogVO sysLogVO) {
        IPage<SysLog> pageList = sysLogService.getPageList(sysLogVO);
        Map<String, Object> result = new HashMap<>();
        List<SysLog> records = pageList.getRecords();
        long total = pageList.getTotal();
        long size = pageList.getSize();
        long current = pageList.getCurrent();
        result.put("records", records);
        result.put("total", total);
        result.put("size", size);
        result.put("current", current);
        return R.success("返回成功",result);
    }



}
